package xyz.syyrjx.blog.entity;

import java.util.Date;

public class Blog {
    private Long id;
    private String title;
    private String picture;
    private String content;
    private Integer view;
    private Date create_date;
    private Date update_date;
    private Long type;
    private Long tag;
    private Types types;
    private String tip;
    private Long commentNum = 0L;
    private Integer state;


    public Blog(){}

    public Blog(Long id, String title, String picture, String content, Integer view, Date create_date, Date update_date, Long type, Long tag, Integer state) {
        this.id = id;
        this.title = title;
        this.picture = picture;
        this.content = content;
        this.view = view;
        this.create_date = create_date;
        this.update_date = update_date;
        this.type = type;
        this.tag = tag;
        if(content != null){
            int end = 0;
            if(content.length() > 50){
                end = 50;
            }else {
                end = content.length();
            }
            this.tip = content.substring(0,end);
        }
        this.state = state;
    }

    public String getTip() {
        return tip;
    }

    public void setTip(String tip) {
        this.tip = tip;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
        if(content != null){
            int end = 0;
            if(content.length() > 50){
                end = 50;
            }else {
                end = content.length();
            }
            this.tip = content.substring(0,end);
        }
    }

    public Integer getView() {
        return view;
    }

    public void setView(Integer view) {
        this.view = view;
    }

    public Date getCreateDate() {
        return create_date;
    }

    public void setCreateDate(Date create_date) {
        this.create_date = create_date;
    }

    public Date getUpdateDate() {
        return update_date;
    }

    public void setUpdateDate(Date update_date) {
        this.update_date = update_date;
    }

    public Long getType() {
        return type;
    }

    public void setType(Long type) {
        this.type = type;
    }

    public Long getTag() {
        return tag;
    }

    public void setTag(Long tag) {
        this.tag = tag;
    }

    public Types getTypes() {
        return types;
    }

    public void setTypes(Types types) {
        this.types = types;
    }

    public Long getCommentNum() {
        return commentNum;
    }

    public void setCommentNum(Long commentNum) {
        this.commentNum = commentNum;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }
}
